package com.pine.app.module.security.oauth.user;


import com.pine.app.module.security.core.common.AuthConstant;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * @Description:  基础登陆
 * @Author: xiaoyuan
 * @Date: 2020/3/18 20:36
 */
@Data
public class IntegrationLoginRequest {

    private String authType;
    private String username;
    private Map<String,String[]> authParameters;

    public String getAuthParameter(String paramter){
        String[] values = this.authParameters.get(paramter);
        if(values != null && values.length > 0){
            return values[0];
        }
        return null;
    }

    public String getUsername() {
        return StringUtils.isBlank(username)?getAuthParameter(AuthConstant.username):username;
    }
}
